package org.blogwu.learn.multithread.chapter2.demo3;

/**
 * wait notify学习
 *
 * @author hyf
 * @date 2018-09-12
 **/
public class SimpleWN implements Runnable {
    public static Object o1 = new Object();


    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + " start");
        synchronized (o1) {
            try {
                System.out.println(Thread.currentThread().getName() + " wait");
                o1.wait();
                System.out.println(Thread.currentThread().getName() + " notify");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println(Thread.currentThread().getName() + " end");
    }
}
